package cn.dg.manager.warehouse.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import cn.dg.manager.common.dao.impl.BaseDaoImpl;
import cn.dg.manager.warehouse.dao.WarehouseDetailDao;
import cn.dg.manager.warehouse.entity.WarehouseDetailInfoVO;
import cn.dg.manager.warehouse.entity.WarehouseDetailResultBean;

@Repository("warehouseDetailDao")
public class WarehouseDetailDaoImpl extends BaseDaoImpl implements WarehouseDetailDao {

	public static final String WAREHOUSE_DETAIL_SQL_PACKAGE = WarehouseDetailDao.class.getName().concat(".");
	
	/**
	 * 获取入库信息详细编辑数据
	 */
	public List<WarehouseDetailInfoVO> getWarehouseDetailEditInfo(String warehouseId) {
		Map<String, Object> cond = new HashMap<String, Object>();
		cond.put("warehouseId", warehouseId);
		return this.sqlSessionTemplate.selectList(WAREHOUSE_DETAIL_SQL_PACKAGE.concat("getWarehouseDetailEditInfo"), cond);
	}

	/**
	 * 根据入库号删除入库详情数据
	 * 
	 */
	public long delWarehouseDetailInfoByIDList(List<String> warehouseIDList) {
		return (int)this.sqlSessionTemplate.delete(WAREHOUSE_DETAIL_SQL_PACKAGE.concat("delWarehouseDetailInfoByIDList"), warehouseIDList);
	}

	/**
	 * 入库详情信息
	 */
	public List<WarehouseDetailResultBean> getWarehouseDetailInfo(Map<String, Object> params) {
		return this.sqlSessionTemplate.selectList(WAREHOUSE_DETAIL_SQL_PACKAGE.concat("getWarehouseDetailInfo"), params);
	}

	/**
	 * 批量插入入库详细信息
	 */
	public int insertWarehouseDetailList(List<WarehouseDetailInfoVO> warehouseDetailVOList) {
		return (int)this.sqlSessionTemplate.insert(WAREHOUSE_DETAIL_SQL_PACKAGE.concat("insertWarehouseDetailList"), warehouseDetailVOList);
	}
}
